/*
 * Copyright (c) 2007 Aleksey Nikiforov
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are
 * met:
 *
 * * Redistributions of source code must retain the above copyright
 *   notice, this list of conditions and the following disclaimer.
 *
 * * Redistributions in binary form must reproduce the above copyright
 *   notice, this list of conditions and the following disclaimer in the
 *   documentation and/or other materials provided with the distribution.
 *
 * * Neither the name of 'Aleksey Nikiforov' nor the names of other contributors 
 *   may be used to endorse or promote products derived from this software 
 *   without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

package org.lex.input.mouse.component;


import org.lex.input.mouse.Cursor;

import com.jme.input.InputHandler;
import com.jme.math.Vector2f;

/**
 * 
 * @author lex
 *
 */
public interface BasicMouse {

	/**
	 * Default cursor used when null cursor is specified.
	 * 
	 * This cursor is required for software mose to be
	 * fail-free, so that all the operations always succeed.
	 * Also fixes some errors related to setting null harware cursor.
	 */
	public static final Cursor defaultCursor = Cursor.load(
			SoftwareMouse.class.getClassLoader().getResource(
					"org/lex/input/mouse/component/default.car"));
	
	
	/**
	 * The hotSpotPosition is only updated when the mouse is enabled.
	 * @return the hotSpotPosition
	 */
	public Vector2f getHotSpotPosition();
	
	
	/**
	 * @param x
	 * @param y
	 */
	public void setHotSpotPosition(float x, float y);
	
	
	/**
	 * @param position
	 */
	public void setHotSpotPosition(Vector2f position);
	
	/**
	 * Input handler to get updates from. Setting input handler
	 * does not enable the mouse. Chaging the handler will
	 * not affect mouse enabled/disabled status, unless the passed
	 * handler is null, in which case mouse will become disabled.
	 * @param handler
	 */
	public void registerWithInputHandler(InputHandler handler);
	
	/**
	 * Changes the cursor. Does not change the status of the mouse
	 * (i.e. will not make the cursor visible or enable the mouse when called).
	 * Setting the null cursor will have implementation specific result.
	 * Setting the cursor the same as the current cursor will cause animation
	 * to reset.
	 * @param cursor cursor to be used
	 */
	public void setCursor(Cursor cursor);
	
	/**
	 * @return the current cursor
	 */
	public Cursor getCursor();
	
	/**
	 * Disabled mouse: mouse will not be visible and
	 * it's hotSpotPosition will not update. This methods is not guaranteed
	 * to always succeed.
	 */
	public void disable();
	
	/**
	 * Enable mouse: mouse will visible and its hotSpotPosition will be updated
	 * (i.e. you will see a cursor and that cursor can move). This methods
	 * is not guaranteed to always succeed.
	 */
	public void enable();
	
	/**
	 * enabled = moves and cursor is visible
	 * disabled = cannot move and cursor is not visible
	 * @return true if mouse is enabled, false otherwise
	 */
	public boolean isEnabled();
	
}
